#include "registerwin.h"
#include "faceserver.h"
#include "query.h"
#include <QApplication>
#include <QSqlDatabase>
#include <QSqlError>
#include <QSqlQuery>
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);



    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    db.setDatabaseName("server.db");
    if(!db.open())
    {
        qDebug()<<"fail"<<endl;
        return -1;
    }

    QString querys = "create table if not exists employee(ID integer primary key autoincrement,name varchar(256),sex varchar(32),job text,birthday text,phone text,faceID integer unique,headfile text)";
    QSqlQuery query1;
    if(!query1.exec(querys)){
         qDebug()<<"querys fail"<<endl;
        return -1;
    }
    querys = "create table if not exists timetable(timeID integer primary key autoincrement,employeeID integer,timelast TimeStamp NOT NULL DEFAULT(datetime('now','localtime')))";

    if(!query1.exec(querys)){
        qDebug()<<"querys2 fail"<<endl;
        return -1;
    }
    query q;
    q.show();
    registerWin rw;
    rw.show();
    faceServer fw;
    fw.show();
    return a.exec();
}
